package com.leetcode.demo3Solution.java;

import com.sun.javafx.scene.traversal.SubSceneTraversalEngine;

public class demo1281 {
    public static void main(String[] args) {
          int n=234;
          System.out.println(subtractProductAndSum(n));
    }
    public static  int subtractProductAndSum(int n) {
        String num=n+"";
        int cheng=1,he=0;
     for(int i=0;i<num.length();i++){
         cheng*=Integer.parseInt(num.substring(i,i+1));
         he+=Integer.parseInt(num.substring(i,i+1));
     }
        return cheng-he;
    }
}
